//
//  canpinTableViewCell.m
//  hainingOASystem
//
//  Created by michael on 2017/11/16.
//  Copyright © 2017年 czd. All rights reserved.
//
#import "EYTextField.h"

#import "canpinTableViewCell.h"

@implementation canpinTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.bgView  = [[UIView alloc]init];
 _label1 = [[UILabel alloc]init];
    _label1.frame = CGRectZero;
    
      [_label1 setFont:[UIFont boldSystemFontOfSize:14]];
       [self.bgView addSubview:_label1];
    
       _label2 = [[UILabel alloc]init];
    _label2.frame = CGRectZero;
    _label2.numberOfLines = 0;
      [_label2 setFont:[UIFont systemFontOfSize:12]];
       [self.bgView addSubview:_label2];
    
       _label3 = [[UILabel alloc]init];
    _label3.frame = CGRectZero;
      [_label3 setFont:[UIFont systemFontOfSize:12]];
       [self.bgView addSubview:_label3];
    
 _label4 = [[UILabel alloc]init];
    _label4.frame = CGRectZero;
      [_label4 setFont:[UIFont systemFontOfSize:12]];
       [self.bgView addSubview:_label4];
_image = [[UIImageView alloc]init];
_image.frame = CGRectZero;
       [self.bgView addSubview:_image];

}

return self;

}
- (void)layoutSubviews{
[super layoutSubviews];
  self.bgView.frame =  CGRectMake(10, 5, KScreenWidth - 20, 150);
    self.bgView.backgroundColor = [UIColor whiteColor];
    //给bgView边框设置阴影
    self.bgView.layer.shadowOffset = CGSizeMake(1,1);
    self.bgView.layer.shadowOpacity = 0.3;
    self.bgView.layer.shadowColor = [UIColor blackColor].CGColor;
        self.bgView.layer.cornerRadius = 5;

    [self.contentView addSubview:self.bgView];
_label1.frame =CGRectMake(10, 10, 200, 20);
if ([_type isEqualToString:@"tuijian"]) {
    _label1.text = [NSString stringWithFormat:@"%@(推荐)", _dic[@"productType"]];

}else{
_label1.text = _dic[@"productType"];


}
//0F52C1
//        tagView.colorInputBg=COLORRGB(0xffffff);

_label1.textColor = COLORRGB(0x0F52C1);//其中textColor要用UIColor类型
_image.frame  = CGRectMake(_label1.left, _label1.bottom, 100, 100);
NSString *url = [NSString stringWithFormat:@"%@%@",kip,_dic[@"pageUrl"]];

    [self.image sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:nil];
_label2.frame =CGRectMake(_image.right+10, _image.top,KScreenWidth-100-20-10-10, 60);
_label2.textColor = [UIColor blackColor];//其中textColor要用UIColor类型
_label2.text = _dic[@"productContent"];
_label3.frame =CGRectMake(_image.right+10, _label2.bottom, _label2.width, 20);
//UIColor *myColor = [UIColor colorWithWhite:0.5 alpha:0.1]
    UIColor *testColor= [UIColor colorWithRed:140/255.0 green:180/255.0 blue:240/255.0 alpha:1];
_label3.textColor = testColor;//其中textColor要用UIColor类型
_label3.text = [NSString stringWithFormat:@"发布机构:%@",_dic[@"name"]];
_label4.frame =CGRectMake(_image.right+10, _label3.bottom, _label2.width, 20);
_label4.textColor = testColor;//其中textColor要用UIColor类型
_label4.text = [NSString stringWithFormat:@"有效时间:%@",_dic[@"haveTime"]];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
